-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Missing types in JSII assembly, invalid Java code, confusing docs #208
Conversation
Not doing so could cause type checks to fail randomly (assuming the referred-to type has not been processed just yet by the assembler).
Looking at their properties will only list entities that have an existence in the Javascript world, which is not the case of interfaces, for example.
The anonymous class generated by the builders included a verbatim field name from the type specification, which could include Java keywords (such as assert). Appended a $ in front to avoid all collisions there, while also avoiding to collide with the parent builder's _fields.
The `ref` of array types would not include the [], causing them to render in confusing ways in the documentation. Additionally, arrays of union types would only have the [] on the last of the options, which was incorrect. Added parentheses around the possible element types in order to clarify the situation.
ts.DiagnosticCategory.Error, | ||
`Unable to resolve type ${jsiiType.base!.fqn} (base type of ${jsiiType.fqn})`); | ||
} else if (spec.isClassType(baseType)) { | ||
jsiiType.initializer = baseType.initializer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am concerned about defer
. For example, the fact that you only assign the initializer here looks like a potential race condition. How do I know what order these defer
statements actually execution? Now initializer
is a moving target!
I am okay with using defer
for validation (maybe should be renamed to validate
), but it seems very fragile for mutations of the model
And fix a bug which failed complication if a namespace contained /only/ an interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated PR with coverage to interfaces exported within namespaces
[0.7.2](v0.7.1...v0.7.2) (2018-09-06) Bug Fixes * Missing types in JSII assembly, invalid Java code, confusing docs ([#208](#208)) ([b37101f](b37101f)), closes [#175](#175) Features * **jsii:** Re-implemented jsii to support --watch and produce better error reporting ([#188](#188)) ([76472be](76472be))
[0.7.2](v0.7.1...v0.7.2) (2018-09-06) Bug Fixes * Missing types in JSII assembly, invalid Java code, confusing docs ([#208](#208)) ([b37101f](b37101f)), closes [#175](#175) Features * **jsii:** Re-implemented jsii to support --watch and produce better error reporting ([#188](#188)) ([76472be](76472be))
* v0.7.2 [0.7.2](v0.7.1...v0.7.2) (2018-09-06) Bug Fixes * Missing types in JSII assembly, invalid Java code, confusing docs ([#208](#208)) ([b37101f](b37101f)), closes [#175](#175) Features * **jsii:** Re-implemented jsii to support --watch and produce better error reporting ([#188](#188)) ([76472be](76472be)) * Check in changes to tarball expectations.
jsii
would omit interfaces defined within namespaces because of the way namespaces were processed (using members instead of listing all exports).jsii
type validations could, in some rare cases, happen too early, attempting to dereference types that hadn't been processed yet.jsii-pacmak
generator for Java could generate property names that were reserved words (e.g:assert
).jsii-pacmak
generator for Sphinx would generate confusing (or incorrect) type documentation for entities of array types, and particularly so for arrays of unions.Should probably add (I don't believe I'll be able to do this before I go on holidays 😅):
jsii-calc
or its dependencies that exercise the interface-in-namespace.jsii-calc
or its dependencies that exercise reserved words of various languages.